<template>
	<view class="root-box">
		<uv-navbar :title="policyTitle" autoBack placeholder />
		<view class="content">
			<view class="rich-text" v-html="htmlContent"></view>
		</view>

	</view>
</template>

<script setup>
	import {
		ref
	} from 'vue'
	import {
		useUserStore
	} from '@/store'
	import {
		storeToRefs
	} from 'pinia'
	import {
		getIconPath
	} from '@/util'
	import {
		agreementDetail
	} from '@/api'
	import {
		onLoad
	} from '@dcloudio/uni-app'
	
	import { showMessageBack,isEmpty } from '@/util/tools.js'

	const policyTitle = ref('')


	const htmlContent = ref('')

	onLoad((option) => {
		console.log('privacy_policy 页面 onLoad 参数：', option)
		let param = {}
		param.type = option.type
		param.agreement_type = option.agreement_type
		setPage(param)

	})

	const setPage = async (param) => {
		const result = await agreementDetail(param);
		console.log('agreementDetail--result', result)
		if (result.code == 200) {
			let _val = result.result
			if(isEmpty(_val)){
				showMessageBack('暂无相关信息', 2000)
			}
			policyTitle.value = _val.title
			htmlContent.value = _val.content
		}

	}

	const user = useUserStore()
	const {
		token,
		userInfo
	} = storeToRefs(user)
	const init = async () => {

	}

	init()
</script>

<style lang="scss" scoped>
	.root-box {
		background-color: $uv-bg-color;
		min-height: 100vh;
		padding-top: calc(var(--status-bar-height) + 30rpx);

		.content {
			box-sizing: border-box;
			background-color: $uv-bg-color;
			padding: 30rpx;
		}

		.rich-text>p {
			font-size: 16px;
		} 


	}
</style>